	_arry = _this;
	_heloname = _arry select 0;
	_callsign = _arry select 1;
	_home = _arry select 2;
	_airport = _arry select 3;
	_egress = _arry select 4;
	_ingress = _arry select 5;
	_helo = _arry select 0;
	_class = typeof _helo;

if(_helo getVariable "RUM_inFlight")exitwith{hint "Helo in flight";};
if((_helo iskindof "Plane")&&(_class != "MV22"))then{_helo setfuel 0};

//////////////////////////////// Start of Map section //////////////////////////////////

RUM_ASclick = false;

openMap [true,true];
for [{_n=1},{_n<=3},{_n=_n+1}] do {
	_mkrname = "";
	_type = "";
	_hint = "";
	switch (_n) do {
		case 1: {
			_mkrname = format ["%1target",_helo];
			_type = "mil_pickup";
			_hint = "Select Pick-Up LZ";
		};
		case 2: {
			_mkrname = format ["%1ingress",_helo];
			_type = "mil_start";
			_hint = "Select Pick-Up LZ Ingress Point";
		};
		case 3: {
			_mkrname = format ["%1egress",_helo];
			_type = "mil_end";
			_hint = "Select Pick-Up LZ Egress Point";
		};
		default {
			hint "shit";	
		};
	};
	_asloc = createMarkerLocal [_mkrname, [0,0,0]];
	_asloc setMarkerShapeLocal "ICON";
	_mkrname setMarkerTypeLocal _type;
	_stgtar = format ["'%1' setMarkerPosLocal _pos,RUM_ASclick = true",_mkrname];
	onMapSingleClick _stgtar;
	cutText [_hint, "PLAIN DOWN"];
	waitUntil {RUM_ASclick};
	if((_n == 2) or (_n == 3)) then {
		_mkrname2 = format ["%1target",_helo];
		_mkrname setMarkerDirLocal ((getMarkerPos _mkrname2 select 0)-(getMarkerPos _mkrname select 0)) atan2 ((getMarkerPos _mkrname2 select 1)-(getMarkerPos _mkrname select 1));
	};
	onMapSingleClick "";
	RUM_ASclick = false;
};
titleFadeOut 0;
sleep 1;
openMap [false,false];

//////////////////////////////////// End of Map section //////////////////////////////////
//////////////////////////////////// Start of Helo Setup //////////////////////////////////

	_helo setVariable ["RUM_inFlight", true, true];

// delete and replace the static helo - client side
	_heloNewName = str(_heloname);

// grabs the position of the helo prior to being deleted so it can be repositioned at the same place on an LHD
	_heliPosASL = [getposASL _helo select 0, getposASL _helo select 1,(getposASL _helo select 2)*0 + 17.5];

	deleteVehicle _heloname;
	_spwndir = getdir _home;

// create vehicle client side
	_helo = createVehicle [_class, getPos _home, [], 0, "NONE"];
	_helo setVehicleVarName _heloNewName;

	
// checks to see if the helo is either over water or on land and place accordingly
	if (surfaceIsWater (getpos _home)) then {
		// player sidechat format["Heli is on LHD or Ship, %1",_heliRoute];
		_helo setPosASL _heliPosASL;
	}else{
		// player sidechat format["Heli is not over water, %1",_heliRoute];
		_helo setpos getpos _home;
	};
	
	_helo setdir _spwndir;
	_arry = [_helo,_callsign,_class,_home,_airport,_egress,_ingress];
	
// create units to fly helo - client side
	sleep 3;
	_crew = [];
	_grp = createGroup side player;
	_pilot = _grp createUnit [RUM_THEL_Pilot, getpos _home, [], 0, "FORM"];
	_helo lockDriver false;
	_pilot moveinDriver _helo;
	_helo lockDriver true;
	_crew = _crew + [_pilot];
	_grp2 = createGroup side player;
	_cfg=configFile >> "CfgVehicles" >> typeof _helo >> "turrets";

// if (surfaceIsWater (getpos _home)) then {

	for [{_n=0},{_n<count _cfg},{_n=_n+1}] do {
		_gunner = _grp2 createUnit [RUM_THEL_Pilot, getpos _home, [], 0, "FORM"];
		_helo lockTurret [[_n], false];
		_gunner moveinTurret [_helo,[_n]];
		_helo lockTurret [[_n], true];
		if!(_gunner in crew _helo)then{deleteVehicle _gunner};
		_crew = _crew + [_gunner];
	};
// };
	_grp2 setCombatMode "RED";
	_grp2 setBehaviour "COMBAT";
	
//////////////////////////////////// End of Helo Setup //////////////////////////////////
_varOM = false;

if(_helo iskindof "Plane")then{_helo FlyInHeight RUM_THEL_flyHeightPLN}else{_helo FlyInHeight RUM_THEL_flyHeight};

["extract",[player,_pilot,_callsign]] execVM (RUM_PATH+"Transport\radiodialogs.sqf");
sleep 15;

//
_helo engineOn true;

for [{_n=1},{_n<=3},{_n=_n+1}] do {
	_mkrname = "";
	switch (_n) do {
		case 1: {
			[_mkrname,_grp,_egress] call RUM_THel_moveWPTakeoff; [_mkrname,_grp,_egress] call RUM_THel_moveWPNormal;
		};
		case 2: {
			_mkrname = format ["%1ingress",_helo];
			[_mkrname,_grp] call RUM_THel_movewaypoint;
		};
		case 3: {
			_mkrname = format ["%1target",_helo];
			[_mkrname,_grp,_helo] call RUM_THel_landwaypoint;
			if (_class == "MV22") then {
				sleep 45;
			};
			call RUM_THel_VehicleOptions;
		};
	};
};

if(RUM_THEL_smokeLZ)then{
	_helo spawn {
		_mkrname = format ["%1target",_this];
		_asloc = getMarkerPos _mkrname;
		waitUntil{((((getPos _this select 0) - (_asloc select 0))^2+((getPos _this select 1) - (_asloc select 1))^2)^0.5) < 1500};
		_smoke = createVehicle ["SmokeShell", _asloc, [], 0, "NONE"];
	};
};

_cont = format ["%1",_helo];
RUM_THel_land = "";
waitUntil {(!alive _helo) or (RUM_THel_land == _cont)};

_helo land "get in";

	_stg = format ["%1 : Move On!",_callsign];
	_stg2 = format ["%1 : Abort, RTB!",_callsign];
	
if (alive _helo) then {
	RUM_THel_actionid = player addAction [_stg, (RUM_PATH+"Transport\om.sqf"),[_helo,_callsign]];
	RUM_THel_actionid2 = _helo addAction [_stg, (RUM_PATH+"Transport\om.sqf"),[_helo,_callsign],1,false,true,"","_this in _target"];
	// RUM_THel_actionid3 = player addAction [_stg2, (RUM_PATH+"Transport\abort.sqf"),[_arry]];

};

_helo setVariable ["RUM_THel_continue",false,true];
waitUntil {(!alive _helo) or (_helo getVariable "RUM_THel_continue")};
if(RUM_THEL_invisibleH)then{deleteVehicle _lz};
if(_helo iskindof "Plane")then{_helo FlyInHeight RUM_THEL_flyHeightPLN}else{_helo FlyInHeight RUM_THEL_flyHeight};

for [{_n=1},{_n<=3},{_n=_n+1}] do {
	_mkrname = "";	
	switch (_n) do {	
		case 1: {
			_mkrname = format ["%1egress",_helo];
			[_mkrname,_grp] call RUM_THel_moveWPLZDustOff; [_mkrname,_grp] call RUM_THel_moveWPLZDustOffNormal;};
		case 2: {
			[_mkrname,_grp,_ingress] call RUM_THel_movewaypoint;
		};
		case 3: {
			[_mkrname,_grp,_home] call RUM_THel_LandHome;
		};
	};
};

	_end = format ["%1",_helo];
	sleep 5;
	waitUntil{(!alive _helo) OR (RUM_THel_endflight == _end)};

	// crew members will exit vehicle
	{unassignVehicle _x;_x action ["GETOUT",_helo];} forEach units _grp2;
	// wait till player(s) have exited the vehicle
	// player sidechat "Exit the vehicle";
	sleep 10;
	waitUntil{(!alive _helo) OR (count(crew _helo) == 0)};

// check to make sure the vehicle is alive and that it has no crew members still mounted
if ((alive _helo) and (count(crew _helo) == 0)) then {
	sleep 1;
	// delete all crew members
	{deleteVehicle _x} forEach _crew;
	// give the helo time to settle before it is repositioned and refitted.
	sleep 15;
	_helo setposASL getposASL _home;
	_helo setdir getdir _home;
	_helo setDamage 0;
	_helo setFuel 1;
	_mags = getArray (configFile>>"cfgVehicles">>typeOf _helo>>"Turrets">>"MainTurret">>"magazines");
	{_helo removeMagazine _x} forEach magazines _helo;
	{_helo addMagazine _x} forEach _mags;
};

	// delete all the markers that were created for this instance.
	_mkrname1 = format ["%1ingress",_helo];
	_mkrname2 = format ["%1target",_helo];
	_mkrname3 = format ["%1egress",_helo];
	deletemarkerLocal _mkrname1;
	deletemarkerLocal _mkrname2;
	deletemarkerLocal _mkrname3;

	_mkrname4 = format ["%1ingress2",_helo];
	_mkrname5 = format ["%1target2",_helo];
	_mkrname6 = format ["%1egress2",_helo];
	deletemarkerLocal _mkrname4;
	deletemarkerLocal _mkrname5;
	deletemarkerLocal _mkrname6;

	// this will add the vehicle back to the RUM PDA when resupply has finished. (still has an issue with var passed back)
	// player sidechat format["%1",_arry];
	
	sleep RUM_THEL_ReSupTime;

	RUM_THelAircraft = RUM_THelAircraft + [_arry];
	_helo setVariable ["RUM_inFlight", false, true];

if(true)exitwith{};
